<template>
    <div id="opinions">
        <Spin size="large" fix v-if="Loading"></Spin>
        <table style="width: 100%;height: 48%;" cellpadding="0" cellspacing="1" class="formtable">
            <tr>
                <td class="value">
                    <span style="width:99%;height:95%;font-size: 30px;" class="inputxt"
                          id="resultMsg" name="resultMsg">{{cixx0003Str}}</span>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <br />
        <table style="width: 100%;height: 48%;" cellpadding="0" cellspacing="1" class="formtable">
            <tr>
                <td align="center">
                    <span v-if="!showDownload" style="font-weight:bold;font-size: 30px">{{cixx00031Str}}</span><!-- 核对报告下载功能-->
                    <a style="font-size: 30px" v-if="showDownload"
                       v-on:click="downloadPdf()"
                       target='_blank'>{{cixx00031Str}}</a>

                </td>
            </tr>
        </table>
        <pdfModal ref="pdfModal"></pdfModal>
    </div>

</template>

<script>
    import ICol from "view-design/src/components/grid/col";
    import {postAction} from '@/api/request'
    import DateFormat from "../../../plugins/format"
    import pdfModal from '@/components/system/pdfModal'
    import {CommonMixin} from '@/views/common/js/CommonMixin'

    export default {
        mixins: [CommonMixin],
        components: {
            pdfModal
        },
        name: "application-opinions",
        data() {
            return {
                Loading:false,
                processInstanceId: "",
                opinions: [],
                ss12001Id:'',
                cixx0003 :'',
                cixx0003Str :'',
                cixx0031:'',
                cixx00031Str:'',
                showDownload:false,

            }
        },
        methods: {
            edit(record) {
                this.Loading = true;
                this.ss12001Id = record.ss12001Id
                let url = '/api/ac/subsistence/ss12001Service/getHdInfo';
                let dataParam = {ss12001Id:this.ss12001Id}
                postAction(url, dataParam).then((res) => {
                    if (res.data.data) {
                        this.cixx0003 = res.data.data.cixx0013
                        this.cixx0031 = res.data.data.cixx0031
                        if(this.cixx0031 ==''||this.cixx0031==undefined) {
                            this.showDownload = false;
                            this.cixx00031Str = '核对报告： 暂时未取到核对报告';
                        } else if(this.cixx0031 =='无核对报告查看权限' ) {
                            this.showDownload = false;
                            this.cixx0003Str = '无核对报告查看权限';
                            this.cixx00031Str = '核对报告:无核对报告查看权限';
                        } else {
                            this.showDownload = true;
                            this.cixx0003Str = this.cixx0003;
                            let dateData = DateFormat(res.data.data.cixx0014, 'YYYY-MM-DD')
                            this.cixx00031Str = '核对报告： '+ dateData+'核对报告';
                        }
                        if(res.data.data.cixx0016=='补充核对报告成功') {
                            this.cixx0003Str = '已反馈核对结果'
                        }
                    } else {
                        this.showDownload = false;
                        this.cixx0003Str = '暂时未取到核对信息';
                        this.cixx00031Str = '核对报告： 暂时未取到核对报告';
                    }
                }).finally(() => {
                    this.Loading = false;
                });;

            },
            downloadPdf(){
                //base64文件流
                this.$refs.pdfModal.showFile(this.cixx0031);
                this.$refs.pdfModal.modalKey = this.uuid();
            }
        }
    }
</script>

<style scoped>

    #opinions .opinionsTitle {
        background-color: #57a3f3;
        height: 40px;
        line-height: 40px;
        font-size: 14px;
        color: white;
        padding-left: 15px;
    }

    .opinionsTitle span {
        padding-left: 5px;
        padding-right: 5px;
    }

    #opinions .opinionsInfor {
        margin-top: 15px;
        padding-left: 20px;
    }

    /deep/ .ivu-form-item-label {
        padding-right: 20px;
    }

    /deep/ .ivu-form-item {
        margin-bottom: 10px;
    }

</style>
